<script>
import Header from '../../components/header.vue';
import { api } from '../../api/request.js'
export default{
    name:"questionFeedback",
    components:{
        Header
    },
    data(){
        return{
            headData:{
                title:'问题反馈',
            },
            questionData:{
                question:'',
                phone:'',
            },
        }
    },
    mounted(){
    },
    methods:{
        backClick(){
            this.$router.back();
        },
        async submitFeedback(){
            if(this.questionData.question===''){
                this.$parent.tipShow({
                    title:"请填写您要填写的问题或者建议",
                    duration:2000,
                    type:'tip',
                })
            }
            else{
               let res = await api.addFeedback({desc:this.questionData.question})
                if(res.code==200){
                    this.$parent.tipShow({
                        title:"提交成功",
                        duration:2000,
                        type:'success',
                    })
                }
                else{
                    this.$parent.tipShow({
                        title:res.msg,
                        duration:2000,
                        type:'error',
                    })
                }
            }
        },
    }
}

</script>
<template>
    <div class="questionFeedback">
        <Header :title="headData.title"
        backButton @handeBackClick = "backClick"></Header>
        <div class="feedback-container">
            <div class="feedback-detail">
                <div class="feedback-title">
                    问题反馈
                </div>
                <div class="question-input">
                    <textarea  maxlength="100" v-model="questionData.question" placeholder="在这里描述您遇到的未能解决的问题或者建议~"></textarea>
                    <span>{{questionData.question.length}}/100</span>
                </div>
            </div>
            <!-- <div class="feedback-phone">
                <div class="phone-title">
                    联系方式
                </div>
                <div class="phone-input">
                    <input type="tel" maxlength="11" oninput="value=value.replace(/[^\d]/g,'')" v-model="questionData.phone" placeholder="请填写手机号码，我们将与您直接沟通" />
                </div>
            </div> -->
            <div class="feedback-button" @click="submitFeedback">
                提交
            </div>
        </div>
    </div>
</template>
<style lang="scss">
@import './index.scss';
</style>